import numpy as np
import matplotlib.pyplot as plt
import os
from matplotlib.colors import LogNorm


fname = 'figS3.npz'

# load npz file
data = np.load(fname, allow_pickle=True)
print(data.files)
n = data['n']
nu = data['nu']
D = data['D']
Rxx = data['Rxx']
Vtg = data['Vtg']
Vbg = data['Vbg']
n0 = data['n0'] # density at charge neutrality point
D0 = data['D0'] 
ns = data['ns'] # density at 4 electron per moire unit cell
epsilon = data['epsilon']
device_name = data['device_name']
back_gate_thickness_nm = data['back_gate_thickness_nm']
top_gate_thickness_nm = data['top_gate_thickness_nm']

# plot
fig, ax = plt.subplots(1, 1, figsize=(6, 4))
im = ax.pcolormesh(n-n0, D, Rxx, norm=LogNorm(vmin=1e2, vmax=1e4))
ax.set_xlabel('Density ($10^{12}$ cm$^{-2}$)')
ax.set_ylabel('$D/\epsilon_0$ (V/nm)')
ax.set_title('Fig. S3')
cbar = fig.colorbar(im, ax=ax)
cbar.set_label('$R_{xx}$ ($\Omega$)')
plt.show()